feat(web): self-serve forgot/reset-password flow - #20
Merged
Conversation
Backend: - New password_reset token store (opaque, single-use, expiring) mirroring refresh_tokens; TTL via password_reset_ttl_minutes (default 30). - POST /auth/forgot-password (enumeration-safe, neutral 200) and POST /auth/reset-password (single-use consume, set_password, sign in). - Resend password-reset email; both routes added to the auth rate limiter. Frontend: - requestPasswordReset/resetPassword clients, "Forgot password?" link on signin, and /forgot-password + /reset-password pages. Tests: tests/test_auth_password_reset.py (neutral responses, single-use, sign-in afterward, invalid/weak-token rejection). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a complete self-serve forgot password flow on top of the existing local email+password auth.
Backend (
app/)core/password_reset.py- opaque, single-use, expiring reset-token store mirroringrefresh_tokens(SHA-256 at rest, memory dev / Redis prod, atomic consume). TTL viapassword_reset_ttl_minutes(default 30).POST /auth/forgot-password- enumeration-safe: identical neutral 200 for known/unknown email; only mints a token + sends mail for a real active account; internal errors swallowed so they can't be an existence oracle.POST /auth/reset-password- validates password, single-use consume,set_password, clears lockout, signs the user straight in (same{token, refresh_token, principal}as signin).core/email.py::send_password_reset_emailvia Resend; never raises.Frontend (
apps/web/)requestPasswordReset/resetPasswordAPI clients./forgot-passwordand/reset-passwordpages reusing the AuthForm visual shell.Tests
tests/test_auth_password_reset.py- neutral responses, single-use token, sign-in afterward, invalid/weak-token rejection. Frontendtypecheck+lint+ productionbuildall pass.Notes
PB_RESEND_API_KEYis set in Render (same prerequisite as invites); the token is still valid before then.🤖 Generated with Claude Code